package com.cms.model;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * 角色�?
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "t_role")
public class Role implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 7123031100950590037L;
	/*
	 * 数据库ID
	 */
	@Id
	@GeneratedValue(strategy =GenerationType.AUTO)
	private int id;
	/*
	 * 角色名称
	 */
	@Column
	private String name;
	/*
	 * 角色优先级，即和其他角色产生冲突的时�?使用那个的权�?
	 */
	@Column
	private int rule;
	/*
	 * 角色下面的管理员信息
	 */
	//@ManyMany(target = Manager.class, from = "role_id", to = "manager_id", relation = "t_manager_role")
	@ManyToMany(mappedBy = "roles")
	private List<Manager> manager =new ArrayList<Manager>();
	/*
	 *角色对应的权限信�?
	 */
//	@OneToMany(mappedBy = "role")
//	private List<Permission> permissions;
	
	@OneToMany(mappedBy="role")
	private List<Permission> pesrmissions =new ArrayList<Permission>();
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getRule() {
		return rule;
	}

	public void setRule(int rule) {
		this.rule = rule;
	}

	public List<Manager> getManager() {
		return manager;
	}

	public void setManager(List<Manager> manager) {
		this.manager = manager;
	}

	public void setPesrmissions(List<Permission> pesrmissions) {
		this.pesrmissions = pesrmissions;
	}

	public List<Permission> getPesrmissions() {
		return pesrmissions;
	}

//	public void setPermissions(List<Permission> permissions) {
//		this.permissions = permissions;
//	}
//
//	public List<Permission> getPermissions() {
//		return permissions;
//	}

	
	
}
